home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / tpapi.exe / EXAMPLES / BINDLIS1.PAS next >
Pascal/Delphi Source File  |  1994-01-14  |  3KB  |  102 lines

  1. {***************************************************************************}
  2. {** Program : BLIST.PAS                                                   **}
  3. {***************************************************************************}
  4. {** Version : 1.0             ** Started :           ** Ended :           **}
  5. {***************************************************************************}
  6. {******************************** Description ******************************}
  7. {***************************************************************************}
  8. {** BLIST will simply list all the objects in the bindery of a specified  **}
  9. {** type.                                                                 **}
  10. {**                                                                       **}
  11. {**                                                                       **}
  12. {**                                                                       **}
  13. {***************************************************************************}
  14. {******************************** Information ******************************}
  15. {***************************************************************************}
  16. {** USAGE :                                                               **}
  17. {**                                                                       **}
  18. {**   BLIST SearchSpec BinderyObjectType                                  **}
  19. {**                                                                       **}
  20. {**                                                                       **}
  21. {***************************************************************************}
  22.  
  23. program BLIST;
  24.  
  25. USES
  26.  
  27.   {$IFDEF WINDOWS}
  28.   wincrt,
  29.   {$ENDIF}
  30.   nwvar,
  31.   nwerror,
  32.   nwmisc,
  33.   objects;
  34.  
  35. VAR
  36.  
  37.   MiscFunc    : MiscFuncOBJ;
  38.   CommandLine : STRING;
  39.   BObjectType : OT_BinderyType;
  40.   BSearchSpec : TObjectName;
  41.  
  42. procedure GetCommandLine;
  43.  
  44. BEGIN
  45.  
  46.   if paramcount < 2 then
  47.     begin
  48.  
  49.       writeln;
  50.       writeln ('You must supply two parameters :');
  51.       writeln;
  52.       writeln ('BINDLIST <searchspec> <ObjectType>');
  53.       writeln;
  54.       writeln ('Examples : Users        = 1');
  55.       writeln ('         : Groups       = 2');
  56.       writeln ('         : PrintQueues  = 3');
  57.       writeln ('         : FileServers  = 4');
  58.       writeln ('         : PrintServers = 7');
  59.  
  60.       halt;
  61.  
  62.     end;
  63.  
  64.   BSearchSpec := MiscFunc.UppercaseNW (PARAMSTR (1));
  65.   BObjectType := MiscFunc.StrToInt (paramstr (2));
  66.  
  67. END; {GetCommandLine}
  68.  
  69. {***}
  70.  
  71. procedure DisplayBinderyObjects;
  72.  
  73. var
  74.  
  75.   AllObjects  : PStringCollection;
  76.   NoOfObjects : word;
  77.   Count       : word;
  78.  
  79. BEGIN
  80.  
  81.   AllObjects := new (PStringCollection, Init (10, 5));
  82.   MiscFunc.GetAllObjects (BSearchSpec, BObjectType, AllObjects, NoOfObjects);
  83.   for Count := 0 to pred (NoOfObjects) do
  84.     writeln (pstring (AllObjects^.At (Count))^);
  85.  
  86.   dispose (AllObjects, Done);
  87.  
  88. END; {DisplayBinderyObjects}
  89.  
  90. {***}
  91.  
  92. BEGIN
  93.  
  94.   MiscFunc.Init (true);
  95.   GetCommandLine;
  96.   DisplayBinderyObjects;
  97.   MiscFunc.Done;
  98.  
  99. END.
  100.  
  101.  
  102.